import Axios from "./request";
import { removeToken } from "@/utils/storage";

/**
 * 登录
 * @method login
 */
export const login = (params: any) => {
    //模拟接口
    return new Promise((resolve, reject) => {
        const { userName, passWord } = params
        if (userName === 'admin' && passWord === 'admin') {
            resolve({ code: 0, msg: '登录成功！', token: 'admin' })
        } else {
            resolve({ code: 500, msg: '账号或密码错误！' })
        }
    })
    // return Axios.get("/sys/oauth/token", {
    //     params: params
    // });
}

/**
 * 登出
 * @method logout
 */
export const logout = () => {
    removeToken()
    //模拟接口
    return new Promise((resolve, reject) => {
        resolve('success')
    })
    // return Axios.post("/sys/oauth/logout");
}

/**
 * 获取登录用户信息
 * @method getInfo
 */

// export const getInfo = (params) => Axios.get("/sys/user/info", {
//   params: params
// });

/**
* 获取当前用户的路由信息
* @method getInfo
*/

// export const getRouters = (params) => Axios.get("getRouters", {
//   params: params
// });

/**
 * 修改密码
 * @method putSysUserProfileUpdatePwd
 */

// export const putSysUserProfileUpdatePwd = (data) => Axios.put("sysUser/profile/updatePwd" + data);
